//
//  WYCSelectionCell.m
//  信用卡管理
//
//  Created by 中企互联 on 2017/11/15.
//  Copyright © 2017年 李胜军. All rights reserved.
//

#import "WYCSelectionCell.h"
#import "WYCSelectionModel.h"

@implementation WYCSelectionCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    WYCSelectionCell * cell = [tableView dequeueReusableCellWithIdentifier:[WYCSelectionCell ID]];
    cell = [[WYCSelectionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[WYCSelectionCell ID]];
    
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
- (void)setMember{

    self.planlabel = [[UILabel alloc] init];
    self.planlabel.frame = CGRectMake(10, 10, 80, 30);
    self.planlabel.font = [UIFont systemFontOfSize:SmallFont];
    [self.contentView addSubview:self.planlabel];
    
    
    self.maxNumberLabel = [[UILabel alloc] init];
    self.maxNumberLabel.frame = CGRectMake(self.planlabel.frame.size.width+self.planlabel.frame.origin.x, 10, 80, 30);
    self.maxNumberLabel.font = [UIFont systemFontOfSize:SmallFont];
    [self.contentView addSubview:self.maxNumberLabel];
    
    self.maxAmountLabel = [[UILabel alloc] init];
    self.maxAmountLabel.frame = CGRectMake(self.maxNumberLabel.frame.size.width+self.maxNumberLabel.frame.origin.x, 10, 200, 30);
    self.maxAmountLabel.font = [UIFont systemFontOfSize:SmallFont];
    [self.contentView addSubview:self.maxAmountLabel];
    
}
- (void)setSelectionModel:(WYCSelectionModel *)selectionModel{
    
    _selectionModel = selectionModel;
    self.SelectedButton.selected = selectionModel.isSelect;
    
    self.planlabel.text = selectionModel.planName;
    
    self.maxNumberLabel.text = [NSString stringWithFormat:@"日消费%@笔",selectionModel.maxNumber];
    
    self.maxAmountLabel.text = [NSString stringWithFormat:@"消费金额%@-%@",selectionModel.minAmount,selectionModel.maxAmount];
    
}

+(NSString *)ID{
    return @"cell";
}
@end
